<?php


namespace app\api\controller;


use think\facade\Db;

class User extends BaseAuthorized
{
    public function changePassword()
    {
        $param = request()->param();
        $rules = [
            "orgPassword" => "require|length:2,25",
            'password' => 'require|length:6,25',
            'repassword' => 'require|confirm:password',
        ];
        $this->autoValid($rules, $param);
        $res = $this->user->changePassword($param["orgPassword"], $param["password"]);
        if ($res["code"] != 0) {
            $this->error($res['msg'], $res["code"]);
        }
        $this->success("");
    }

    /**
     * 退出登录
     */
    public function loginOut(){
        $res=$this->user->loginOut();
        if ($res["code"] != 0) {
            $this->error($res['msg'], $res["code"]);
        }
        $this->success("退出成功");
    }


}